package com.itheima.duotai2;

public class Test {

    public static void main(String[] args) {
        /*Sheep sheep = new Sheep();
        System.out.println(sheep.mao);
        sheep .eat();
        sheep.age=10;

        Wolf wolf = new Wolf();
        wolf.age=20;
        wolf.zhuazi="狼爪";
        System.out.println(wolf.mao);
        wolf.eat();*/
        //披着羊皮的狼
        Sheep sheep= new Wolf();
        //成员变量 编译看左边
        //sheep.zhuazi="";
        //成员变量  运行也看左边
        System.out.println(sheep.mao);//羊毛
        //成员方法  编译看左边 运行看 右边
        sheep.eat();
        //sheep.ao();
    }
}


class  Sheep{
    String mao="羊毛";
    public  void eat(){
        System.out.println("羊吃草");
    }
}
class Wolf extends Sheep{
   String mao="狼毫";
   public Wolf(){
       super();
   }
    public void eat(){
        System.out.println("狼吃羊");
    }

}